package com.example.myapplication9.week6.jsjf;
public class LinkedBinaryTreeTest {
    public static void main(String[] args) throws InterruptedException {
        LinkedBinaryTree c=new LinkedBinaryTree("b");LinkedBinaryTree b=new LinkedBinaryTree("c");LinkedBinaryTree a=new LinkedBinaryTree("Translation",c,b);
        LinkedBinaryTree e=new LinkedBinaryTree("F");
        LinkedBinaryTree f=new LinkedBinaryTree("g",a,e);
        System.out.println("二叉树的toString方法");
        System.out.println(f.toString());
        System.out.println("二叉树的先序遍历");
        f.preorder(f.getRootNode());
        System.out.println();
        System.out.println("二叉树的后序遍历");
        f.postorder(f.getRootNode());
        System.out.println();
        System.out.println("二叉树的中序遍历");
        f.Inorder(f.getRootNode());
        System.out.println();
        System.out.println("二叉树的层序遍历");
        f.unrecursionlevelOreder(f.getRootNode());
        System.out.println();
        System.out.println( "查找是否包含a的结果:"+f.contains("Translation")+"二叉树中的元素："+"b, c, Translation, F, g");
        System.out.println("查找是否包含A的结果："+f.contains("A")+"二叉树中的元素："+"b, c, Translation, F, g");
        System.out.println("getRight方法的检验，即输出树的根节点的右子树");
        System.out.println(f.getRight().toString());
        System.out.println("getLeft方法的检验，即输出树的根节点的左子树");
        System.out.println(f.getLeft().toString());
        System.out.println("二叉树的高度:"+f.getHeight()+"二叉树的元素个数："+f.size()+"二叉树的根元素"+f.getRootElement());

    }
}
